package com.xcw.jac.multithreadeddownloader;

import com.xcw.jac.multithreadeddownloader.core.Downloader;
import com.xcw.jac.multithreadeddownloader.utils.LogUtils;

import java.util.Scanner;

/**
 * @author xcw
 * @date 2023/8/9 20:05
 * @description 多线程文件下载器
 */
public class Main {
    public static void main(String[] args) {
        String url = null;
       tab: while (true) {
           for (; ;) {
               LogUtils.info("请输入下载链接! 输入quit退出");
               Scanner scanner = new Scanner(System.in);
               url = scanner.next();
               if ("quit".equalsIgnoreCase(url)){
                   break tab;
               }
               if (url != null) {
                   break;
               }
           }
           LogUtils.info("下载链接：{}" + url);
           Downloader.download(url);
       }
    }
}
